/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.myapp.forms;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

/**
 *
 * @author navneet
 */
public class EEFAFB extends org.apache.struts.validator.ValidatorActionForm {
    
    private int id;
    private int groupId;
    private int companyId;
    private int siteId;
    private int entityId;
    private String form_name;
    private String form_action;
    private String form_method;
    private String form_enctype;
    private String description;
    private String error;

    public int getCompanyId() {
        return companyId;
    }

    public void setCompanyId(int companyId) {
        this.companyId = companyId;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public int getEntityId() {
        return entityId;
    }

    public void setEntityId(int entityId) {
        this.entityId = entityId;
    }

    public String getError() {
        return error;
    }

    public void setError(String error) {
        this.error = error;
    }

    public String getForm_action() {
        return form_action;
    }

    public void setForm_action(String form_action) {
        this.form_action = form_action;
    }

    public String getForm_enctype() {
        return form_enctype;
    }

    public void setForm_enctype(String form_enctype) {
        this.form_enctype = form_enctype;
    }

    public String getForm_method() {
        return form_method;
    }

    public void setForm_method(String form_method) {
        this.form_method = form_method;
    }

    public String getForm_name() {
        return form_name;
    }

    public void setForm_name(String form_name) {
        this.form_name = form_name;
    }

    public int getGroupId() {
        return groupId;
    }

    public void setGroupId(int groupId) {
        this.groupId = groupId;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getSiteId() {
        return siteId;
    }

    public void setSiteId(int siteId) {
        this.siteId = siteId;
    }


    public EEFAFB() {
        super();
    }

    public void reset(ActionMapping mapping,HttpServletRequest request){
        id              = -1;
        groupId         = -1;
        companyId       = -1;
        siteId          = -1;
        entityId        = -1;
        form_name       = "";
        form_action     = "";
        form_method     = "";
        form_enctype    = "";
        description     = "";
        error           = "";
    }
    public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
        ActionErrors errors = new ActionErrors();
        if (getGroupId() < 1) {
            errors.add("groupId", new ActionMessage("error.AEFAFB.groupId.required"));
        }
        if (getCompanyId() < 1) {
            errors.add("companyId", new ActionMessage("error.AEFAFB.companyId.required"));
        }
        if (getSiteId() < 1) {
            errors.add("siteId", new ActionMessage("error.AEFAFB.siteId.required"));
        }
        if (getEntityId() < 1) {
            errors.add("entityId", new ActionMessage("error.AEFAFB.entityId.required"));
        }
        if (getForm_name() == null || getForm_name().length() < 1) {
            errors.add("form_name", new ActionMessage("error.AEFAFB.form_name.required"));
        }
        if (getForm_action() == null || getForm_action().length() < 1) {
            errors.add("form_action", new ActionMessage("error.AEFAFB.form_action.required"));
        }
        if (getForm_method() == null || getForm_method().length() < 1) {
            errors.add("form_method", new ActionMessage("error.AEFAFB.form_method.required"));
        }
        return errors;
    }
}
